thread_loop
